<div id="wx" class="tab-pane wx-tab-pane active">
    {{--<div class="mrgud_10">--}}
    <div class="row">
        <div class="col-md-12">
            <form id="wizardForm" class="form-horizontal" method="post" action="">
                {{ csrf_field() }}
                <input type="hidden" value="{{\App\Models\PrizeType\PrizeType::WECHAT}}" name="data[prize][type_code]">
                <input type="hidden" value="{{\App\Models\Prize\Prize::BUILD_BY_CREATE}}" name="data[prize][resource]">
                <div class="row">
                    <div class="col-sm-8">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <label class="col-sm-1 col-sm-offset-1 control-label">奖品名称</label>
                                    <div class="col-sm-8">
                                        <input class="form-control prize-code-name" type="text"
                                               name="data[prize][name]"
                                               datatype="s1-20" ajaxurl="/web/prize/checkName/0">
                                        <div class="info"><span
                                                    class="Validform_checktip"></span><span
                                                    class="dec"><s class="dec1">&#9670;</s><s
                                                        class="dec2">&#9670;</s></span></div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 col-sm-offset-1 control-label">红包金额</label>
                                    <div class="col-sm-8 ">
                                        <input class="form-control wx-input-money"
                                               type="text"
                                               number="true"
                                               name="data[prize][stock_number]"
                                               placeholder="请输入红包金额，单位元"
                                               datatype="/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/"
                                               errormsg="只能输入整数或两位小数"
                                        />
                                        <div class="info"><span
                                                    class="Validform_checktip"></span><span
                                                    class="dec"><s class="dec1">&#9670;</s><s
                                                        class="dec2">&#9670;</s></span></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-10 col-sm-offset-1">
                        <div class="panel panel-info">
                            <div class="panel-heading">
                                <h3 class="panel-title">奖品赞助商信息</h3>
                            </div>
                            <div class="panel-body sponsor_panel">
                                <div class="sponsor_form">
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <img src="/images/admin/delet_red.png"
                                                 class="sponsor_delet pull-right mgb10 mgr30">
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">赞助商信息</label>
                                            <div class="col-sm-8 ">
                                                <input class="form-control" type="text"
                                                       name="data[sponsor][name][]"
                                                       datatype="sponsor">
                                                <div class="info"><span
                                                            class="Validform_checktip"></span><span
                                                            class="dec"><s class="dec1">&#9670;</s><s
                                                                class="dec2">&#9670;</s></span></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">商家Logo</label>
                                            <div class="col-sm-8">
                                                <input type="file" name="upfile"
                                                       accept="image/gif,image/jpeg,image/png"
                                                       data-target="uploadLogoFile"
                                                       data-preview-file-type="text"
                                                       class="form-control fileInput" value="" title=""
                                                       data-for="data[sponsor][logo][]" maxFileSize="200K"
                                                       maxImageWidth="100" maxImageHeight="100">
                                                <input type="hidden" name="data[sponsor][logo][]"
                                                       value="">
                                                <div class="info"><span
                                                            class="Validform_checktip"></span><span
                                                            class="dec"><s class="dec1">&#9670;</s><s
                                                                class="dec2">&#9670;</s></span></div>
                                                <span class="help-block">支持PNG、JPG格式，小于200KB</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">曝光率</label>
                                            <div class="col-sm-7">
                                                <input class="form-control ptr" type="number"
                                                       name="data[sponsor][percent][]"
                                                       datatype="/^100$|^[0-9]{1,2}$/"
                                                       value="0" errormsg="只能输入0~100的整数">
                                                <div class="info"><span
                                                            class="Validform_checktip"></span><span
                                                            class="dec"><s class="dec1">&#9670;</s><s
                                                                class="dec2">&#9670;</s></span></div>
                                            </div>
                                            <label class="col-sm-1 control-label ptl textl">%</label>
                                        </div>
                                    </div>
                                </div>
                                <div class="pull-center mgud">
                                    <button type="button"
                                            class="btn btn-info btn-wd btn-finish panel-sponsor-butten">
                                        添加一个新的赞助商
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="footer pull-center">
                    <button type="submit" class="btn btn-submit btn-info btn-fill btn-wd btn-finish wx_sur">
                        提交
                    </button>
                    <div class="clearfix"></div>
                </div>
            </form>
        </div>
    </div>
    {{--</div>--}}
</div>
{{--订单确认模态框--}}
@component('web.prizePayment.payModel')
@endcomponent
<script>
	var orderId;
	function init() {
		$('.panel-sponsor-butten').on('click', function () {
			var addObj = $(this).parent('.mgud');
			$.get('/web/prize/sponsor', function (res) {
				addObj.before(res);
				var fileInputObj = addObj.prev('.sponsor_form').find('.fileInput');
				initFileInput(fileInputObj);
			});
		});
		$('.sponsor_panel').on('click', '.sponsor_delet', function () {
			if ($('.sponsor_form').length == 1) {
				return;
			}
			$(this).parents('.sponsor_form').remove();
		});
		$('.fileInput').each(function () {
			initFileInput($(this));
		});
		var validformObj = initValidform($('#wizardForm'));
		validformObj.eq(0).config({
			callback: function (data) {
				if (data.message) {
					utils.showNotification(data.message, 3);
					if(data.href){
                        window.location.href = data.href;
                    }
				} else {
					if (data.status != 200) {
						$('#checkModal').find('.modal-footer').find('.btn-primary ').attr('disabled', 'disabled');
					}
					if (data.result) {
						$.get('/payment/payment/check', {'order_id': data.result}, function (res) {
							$('#checkModal').find('.modal-footer').find('.btn-primary ').removeAttr('disabled');
							$('#checkModal').find('.modal-body').html(res);
							$('#checkModal').modal({'backdrop': 'static'});
							orderId = $('#checkModal').find('.modal-body').find('.order_id').text();
						})
					} else {
						$('#checkModal').find('.modal-footer').find('.btn-primary ').removeAttr('disabled');
						$('#checkModal').find('.modal-body').html(data.responseText);
						$('#checkModal').modal({'backdrop': 'static'});
						orderId = $('#checkModal').find('.modal-body').find('.order_id').text();
					}
				}
			}
		})
		payModal('wechat');
	}
</script>